<template>
  <div class="wrapper">
    <swiper class='swiper-container'>
      <!-- slides -->
      <swiper-slide v-for="swiper in swiperList" :key="swiper.id" v-if="showSwiper">
        <img :src="swiper.imgUrl" alt />
      </swiper-slide>
      <!-- Optional controls -->
      <div class="swiper-pagination"></div>
    </swiper>
  </div>
</template>
<script>
import Swiper from 'swiper';
export default {
  data() {
     return {
    //   swiperOption: {
    //     // some swiper options/callbacks
    //     // 所有的参数同 swiper 官方 api 参数
    //     // ...
    //     pagination: '.swiper-pagination',
    //     loop: true
    //   }
     };
  },
  computed: {
    showSwiper() {
      return this.swiperList.length;
    }
  },
  props: {
    swiperList: Array
  },
  methods:{
      _swiper() {
      var mySwiper = new Swiper('.swiper-container', {
      pagination : '.swiper-pagination',
      paginationType : 'fraction',
      autoplay:1
    })
    }
  },
  created(){
    this._swiper()
  },
  mounted() {
   
  }
};
</script>
<style lang="stylus" scoped>
.wrapper >>> .swiper-pagination-bullet-active {
  background: #fff;
}

.wrapper {
  width: 100%;
  overflow: hidden;
  height: 0;
  padding-bottom: 26.66%;

  img {
    width: 100%;
    display: block;
  }
}
</style>
